home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / GameOver.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  2.1 KB  |  103 lines

  1. -- Wait a second and then do this:
  2.  
  3.     -- Don't allow you to exit the game ... yet:
  4.     G.SetPause( false );
  5.  
  6.     MainMenu.OpenWindow( "InGameExitWindow", true);
  7.     
  8.     KillTextPopup();
  9.     
  10.     if( KillCinemaBars ~= nil ) then KillCinemaBars() end
  11.     
  12.     G.OnlyShowMouseOnGui( false );
  13.     G.DisableTrapAll()
  14.     -- G.SetCursorActive( false );
  15.     Cursor.SetVelocity( Vector3(0,0,0) )
  16.  
  17.     -- Set the text:
  18.     gameovertext = LevelExitDesc()
  19.     MainMenu.Message( "InGameOver", "SetText", gameovertext );    
  20.  
  21.     -- Stop the in-game music, play victory/loss music:
  22.     G.StopMusic();
  23.     if( GameState == Victory ) then
  24.         G.LoadSong("Music/invasion_resisted.mp3");
  25.     else
  26.         G.LoadSong("Music/invasion_unopposed.mp3");
  27.     end
  28.  
  29.     G.SetNextLoopingMusic( "Music/moxie_socks.mp3" );
  30.  
  31.  
  32.     -- Change invaders so that they stop attacking!
  33.  
  34.     -- If the tower WAS still there, move the camera to it:
  35.     -- Camera.SetPosition( Tower.GetPosition() )
  36.  
  37. -- Wait until the player acknoledges the loss:
  38. function AcknowledgeGameEnd()
  39.     
  40.     KillImagePopup();
  41.     
  42.     -- Stop traitor Wah-wah
  43.     G.SimpleStopSound( "TraitorTalk" );
  44.  
  45. --    gameovertext = LevelExitDesc();
  46.     GameOverScreen( gameovertext );
  47.  
  48.     MainMenu.CloseWindow( "InGameExitWindow", false);
  49.  
  50.     -- Stop spawning:
  51.     EndAllWaves()    
  52.     
  53.     G.DestroyGroup("invaders");
  54.     G.DestroyGroup("spawners");
  55.     G.DestroyGroup("tower");
  56.     G.DestroyGroup("traps");
  57.     G.DestroyGroup("walls");
  58.     G.DestroyGroup("doodads");
  59.     G.DestroyGroup("effects");
  60.     G.DestroyGroup("cursor");
  61.     G.DestroyGroup("camera");
  62.     G.DestroyGroup("level");
  63.     
  64.     HUD.Destroy();
  65.     Cursor.Destroy();
  66.     G.OnlyShowMouseOnGui( false );
  67.  
  68.     -- This is for the "Retry/Next Level" Button
  69.     if( not(InCampaign) or CurrentLevel == MaxLevelNum ) then
  70.         MainMenu.CloseWindow( "NextLevel", false );
  71.     else
  72.         if( GameState == Victory ) then
  73.             MainMenu.Message( "NextLevel", "SetText", "Go To Next Level" );    
  74.         else
  75.             MainMenu.Message( "NextLevel", "SetText", "Retry Level" );    
  76.         end
  77.  
  78.         MainMenu.OpenWindow( "NextLevel", false );
  79.     end
  80.  
  81.     MainMenu.OpenWindow( "GameOverWindow", false);
  82.  
  83.     G.SetPause( false );        
  84.     DeactivateTraitor();    -- DisableTraitor();
  85.     
  86.  
  87.     G.LogicCleanUp();
  88.  
  89. end     
  90.  
  91.  
  92.  
  93.  
  94.  
  95.     
  96.  
  97.         
  98.  
  99.     
  100.  
  101.  
  102.  
  103.